/* Vhall Stream Saver - Popup Styles */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #333;
  background: #f8f9fa;
  width: 400px;
  min-height: 500px;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 600px;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 24px;
  height: 24px;
}

.title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-icon {
  width: 32px;
  height: 32px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.3);
}

.btn-primary {
  background: #4CAF50;
  color: white;
  padding: 8px 16px;
}

.btn-primary:hover {
  background: #45a049;
}

.btn-secondary {
  background: #6c757d;
  color: white;
  padding: 8px 16px;
}

.btn-secondary:hover {
  background: #5a6268;
}

.btn-small {
  padding: 4px 8px;
  font-size: 12px;
}

/* Status Bar */
.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  border-bottom: 1px solid #e9ecef;
}

.status-info {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stream-count {
  font-weight: 600;
  color: #4CAF50;
  font-size: 16px;
}

.status-text {
  color: #6c757d;
  font-size: 13px;
}

.native-status {
  font-size: 12px;
}

.native-indicator {
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 500;
}

.native-indicator.available {
  background: #d4edda;
  color: #155724;
}

.native-indicator.unavailable {
  background: #f8d7da;
  color: #721c24;
}

.native-indicator.checking {
  background: #fff3cd;
  color: #856404;
}

/* Stream List Container */
.stream-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* Empty State */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  height: 100%;
  min-height: 300px;
}

.empty-icon {
  color: #6c757d;
  margin-bottom: 16px;
}

.empty-state h3 {
  font-size: 16px;
  color: #495057;
  margin-bottom: 8px;
}

.empty-state p {
  color: #6c757d;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 20px;
  max-width: 280px;
}

/* Stream List */
.stream-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stream-item {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.stream-item:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  transform: translateY(-1px);
}

.stream-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.stream-info {
  flex: 1;
  min-width: 0;
}

.stream-title {
  font-size: 14px;
  font-weight: 600;
  color: #212529;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-url {
  font-size: 12px;
  color: #6c757d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stream-time {
  font-size: 11px;
  color: #adb5bd;
  white-space: nowrap;
  margin-left: 12px;
}

.stream-details {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #6c757d;
}

.stream-quality {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.quality-tag {
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  background: #e9ecef;
  color: #495057;
}

.quality-tag.hd {
  background: #d4edda;
  color: #155724;
}

.line-selector select {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  margin-left: 5px;
}

.line-selector select:hover {
  border-color: #007bff;
}

.line-selector select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.stream-actions {
  display: flex;
  gap: 8px;
}

/* Actions Bar */
.actions-bar {
  display: flex;
  gap: 12px;
  padding: 16px;
  background: white;
  border-top: 1px solid #e9ecef;
}

.actions-bar .btn {
  flex: 1;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top: 3px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  color: white;
  margin-top: 16px;
  font-size: 14px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast Container */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1001;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: white;
  border-radius: 6px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
  animation: slideIn 0.3s ease;
}

.toast.success {
  border-left: 4px solid #4CAF50;
}

.toast.error {
  border-left: 4px solid #f44336;
}

.toast.warning {
  border-left: 4px solid #ff9800;
}

.toast-message {
  flex: 1;
  font-size: 13px;
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #6c757d;
  padding: 0;
  width: 16px;
  height: 16px;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: #6c757d;
}

/* Scrollbar */
.stream-list-container::-webkit-scrollbar {
  width: 6px;
}

.stream-list-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.stream-list-container::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.stream-list-container::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
}

/* New: Quality and Line selects */
.quality-select,
.line-select {
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 12px;
  cursor: pointer;
  margin-left: 6px;
}

.quality-select:hover,
.line-select:hover {
  border-color: #007bff;
}

.quality-select:focus,
.line-select:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}